﻿<UserControl x:Class="MissedMemo.MeatAndCheeseDisc.OrderEntry.DeliveryOptionsSelector"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MissedMemo.MeatAndCheeseDisc.OrderEntry">

    <UserControl.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="resColorScheme.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <local:OrderStateToDriverAssignmentEnabledConverter x:Key="DriverAssignmentEnabledConverter" />

        </ResourceDictionary>
    </UserControl.Resources>

    
    <Grid>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>
        
        <Image Grid.Column="0" Source="Resources\Delivery.Gif" Height="24" />
        
        <CheckBox Grid.Column="1" VerticalAlignment="Center" Margin="-10,0,7,0"
                  Foreground="{StaticResource brushDeliveryText}"
                  Content="Delivery:" IsChecked="{Binding DeliveryRequested}" />
        
        <ComboBox Grid.Column="2" Name="comboAssignDriver" Width="100" Height="20"
                  VerticalAlignment="Center" HorizontalContentAlignment="Center" 
                  Background="{StaticResource brushDeliveryDriverCombo}"
                  Foreground="{StaticResource brushDeliveryDriverText}"
                  SelectedValue="{Binding DeliveryDriver}" >
            
            <ComboBox.IsEnabled>
                <MultiBinding Converter="{StaticResource DriverAssignmentEnabledConverter}" >
                    <Binding Path="DeliveryRequested" />
                    <Binding Path="ProcessingState" />
                </MultiBinding>
            </ComboBox.IsEnabled>
            
        </ComboBox>

    </Grid>
    
</UserControl>
